﻿using DLL.Net.MS.Models;
using DLL.NET70.Infrastructure.EventAggregator;
using DLL.NET70.Infrastructure.Prism.EventAggregator;
using DLL.Standard.Infrastructure.Entity;
using Google.Protobuf.WellKnownTypes;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json.Linq;
using Prism.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Module.AutoRun
{
    public interface IMSDMSendCommandMessage : ISendCommandMessage
    {
        void EnableAll(int val);

        void DisableAll();

        void SetFocuse(int val);

        void Online_AllEnable(int val);

        void Online_TPFlushMode(int val);

        void CM_TPFlushMode(int val);

        void Online_ConnectMode(int val);

        void ClearBottleLabel();

        void CM_ClearLabels(int value = 0);

        void CM_ResetStart(int value);

        void CM_RunStart(int value);

        void CM_RunOver(int value);

        void CM_ResetOver(int value);

        void CM_ReplaceInjectorStart(int value);

        void CM_ReplaceInjectorOver(int value);

        void CM_PutDrugStart(int value);

        void CM_PutDrugOver(int value);

        void CM_ClearLogMsg();
    }

    public class CMSDMSendCommandMessag : CSendCommandMessage, IMSDMSendCommandMessage
    {
        private IEventAggregator _eventAggregator;

        public CMSDMSendCommandMessag(IEventAggregator eventAggregator) : base(eventAggregator)
        {
            _eventAggregator = eventAggregator;
        }

        #region 单机模式，发送消息

        //单机模式，发送消息
        private int DeviceConnectkMode = 0;

        public void EnableAll(int val)
        {
            if (DeviceConnectkMode == 0)
            {
                Publish(MSDM_CmdStr.AllEnable, val.ToString());
            }
        }

        public void DisableAll()
        {
            if (DeviceConnectkMode == 0)
            {
                Publish(MSDM_CmdStr.AllDisEnable);
            }
        }

        #endregion 单机模式，发送消息

        public void SetFocuse(int val)
        {
            Publish(MSDM_CmdStr.Focus, val.ToString());
        }

        public void Online_AllEnable(int val)
        {
            Publish(MSDM_CmdStr.AllEnable, val.ToString());
        }

        public void Online_TPFlushMode(int val)
        {
            Publish(MSDM_CmdStr.TPFlushMode, val.ToString());
        }

        public void Online_ConnectMode(int val)
        {
            Publish(MSDM_CmdStr.ConnectMode, val.ToString());
        }

        public void ClearBottleLabel()
        {
            CM_ClearLabels();
        }

        //联机模式发生改变
        public void CM_ConnectMode(int val)
        {
            Publish(MSDM_CmdStr.ConnectMode, val.ToString());
        }

        //统配，混配模式发生改变
        public void CM_TPFlushMode(int val)
        {
            Publish(MSDM_CmdStr.TPFlushMode, val.ToString());
        }

        //复位
        public void CM_ResetStart(int value)
        {
            Publish(MSDM_CmdStr.ResetStart, value.ToString());
        }

        public void CM_ResetOver(int value)
        {
            Publish(MSDM_CmdStr.ResetOver, value.ToString());
        }

        //运行
        public void CM_RunStart(int value)
        {
            Publish(MSDM_CmdStr.Runing, value.ToString());
        }

        public void CM_RunOver(int value)
        {
            Publish(MSDM_CmdStr.RunOver, value.ToString());
        }

        //清空日志信息
        public void CM_ClearLogMsg()
        {
            Publish(GlobalCommand.ClearLogMsg);
        }

        //清空瓶贴
        public void CM_ClearLabels(int value = 0)
        {
            Publish(MSDM_CmdStr.Clear, value.ToString());
        }

        //换针
        public void CM_ReplaceInjectorStart(int value)
        {
            Publish(MSDM_CmdStr.ReplaceInjectorStart, value.ToString());
        }

        public void CM_ReplaceInjectorOver(int value)
        {
            Publish(MSDM_CmdStr.ReplaceInjectorOver, value.ToString());
        }

        public void CM_PutDrugStart(int value)
        {
            Publish(MSDM_CmdStr.PutDrugStart, value.ToString());
        }

        public void CM_PutDrugOver(int value)
        {
            Publish(MSDM_CmdStr.PutDrugOver, value.ToString());
        }
    }
}